/*----------------------------------------------------------------------------*\
| /gamemode/mapconfig.lua              | map configuration system        | SRV |
\*----------------------------------------------------------------------------*/

local mapconf = {}
mapconf.settings = {}
zday.MapConfig = {}

local mapinfo = "info"
mapconf.settings[mapinfo] = {}
mapconf.settings[mapinfo]["areaname"]      = "Default area"
mapconf.settings[mapinfo]["timezone"]      = -420
mapconf.settings[mapinfo]["starttime"]     = 260
mapconf.settings[mapinfo]["endtime"]       = 290
mapconf.settings[mapinfo]["rescuepoint"]   = "Default rescuepoint"

local mapconfig = "config"
mapconf.settings[mapconfig] = {}
mapconf.settings[mapconfig]["bloom"] = {}
mapconf.settings[mapconfig]["bloom"]["darken"] = 0.1
mapconf.settings[mapconfig]["bloom"]["multiply"] = 0.3
mapconf.settings[mapconfig]["bloom"]["sizex"] = 4
mapconf.settings[mapconfig]["bloom"]["sizey"] = 4
mapconf.settings[mapconfig]["bloom"]["passes"] = 1
mapconf.settings[mapconfig]["bloom"]["color"] = 1
mapconf.settings[mapconfig]["bloom"]["colr"] = 1
mapconf.settings[mapconfig]["bloom"]["colg"] = 1
mapconf.settings[mapconfig]["bloom"]["colb"] = 1

function mapconf.CreateDefault()
    local contents = util.TableToKeyValues( mapconf.settings )
    if not file.Exists("zday/map_configs/" .. game.GetMap() .. ".txt") then
        file.Write("zday/map_configs/" .. game.GetMap() .. ".txt", contents )
    end 
end
mapconf.CreateDefault()

function mapconf.Load()
		local contents=file.Read( "zday/map_configs/" .. game.GetMap() .. ".txt" )
		zday.MapConfig = util.KeyValuesToTable(contents)
end
mapconf.Load()
